feat(spec): port formatCnpj to the bridge - #582
hyanmandian wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## claude/bridge-is-valid-cnpj #582 +/- ##
===============================================================
Coverage ? 100.00%
===============================================================
Files ? 183
Lines ? 2069
Branches ? 612
===============================================================
Hits ? 2069
Misses ? 0
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Tree-shaking report✅ No bundle size impact. All 155 exports are the same size as on the base branch (full import 648.9 KB, gzip 166.2 KB). All exports (155)
How this is measuredEvery export is imported alone into an esbuild consumer bundle (minified, tree-shaken) built from the head and from the base of this pull request; the sizes are the resulting bundles, gzip is their gzipped size. 🔴 marks a regression: a pre-existing export that grew more than 20% and more than 256 B, or the bundle importing every pre-existing export growing more than 5%. 🟡 is growth under the threshold, 🟢 a decrease, ⚪ no change, 🆕 an export that does not exist on the base (never a regression), 🗑️ an export that was removed. An intentional increase is accepted with the |
The second utility, and the one that shows what sharing costs. It reads the same two
character classes `isValidCnpj` reads, out of the same `source/_internals/cnpj.ts`, and adds
a mask helper of its own under `source/_internals/mask.ts` — written once, for every
`format*` utility that comes after it.
What each target ends up with is still one self-contained module: the generated
`format-cnpj` carries the mask helper and the two classes it uses, and not a line of the
check digit code, because the compiler prunes what the utility cannot reach. That is the
property the npm package needs, and it is why the helpers are inlined rather than emitted as
a shared module per target.
Three options that interact — `pad`, `version`, `obfuscate` — over the same corpus, so all
seven combinations are replayed against every input.
typescript 4025/4025 python 4025/4025 ruby 4025/4025
go 3983/3983 rust 3983/3983 java 3983/3983
csharp 3983/3983 cabi 3983/3983
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UX1gTGeMTyoXQyr1qUoQKd
72a3a71 to
f701ac0
Compare
b51853d to
dbff7d8
Compare
|
Two red-looking things here, neither of them this PR's:
Everything on GitHub Actions is green or still running. Generated by Claude Code |
What does this PR do?
Stacked on #581, which is stacked on #580 (the compiler). This PR's diff is only what
formatCnpjadds.The second utility, and the one that shows what sharing costs — which is the question a one-file-per-utility layout has to answer.
The diff, in full
source/format-cnpj.tssource/_internals/mask.tsformat*utility after this oneconformance/cases/format-cnpj.tsIt reads the same two character classes
isValidCnpjreads, out of the samesource/_internals/cnpj.ts, and adds nothing to the compiler.What each target ends up with
One self-contained module. The generated
format-cnpjcarries the mask helper and the two classes it uses, and not a line of the check digit code, because the compiler prunes what the utility cannot reach:That is the property the npm package needs, and it is why the helpers are inlined rather than emitted as a shared module per target.
Parity
Three options that interact —
pad,version,obfuscate— so all seven combinations are replayed against every input in the CNPJ corpus.bash spec/bridge/conformance/run-all.sh:The forty-two are six numeric inputs × seven option sets:
formatCnpjacceptsstring | numberin JavaScript, and the compiled targets declare a string.bash spec/bridge/conformance/verify-typescript.sh, now covering both CNPJ utilities:Checklist
npm test) — not applicable: no change tosrc/. The generated output is checked against the package's existing suite byverify-typescript.sh, and against a recording of the shipped package byrun-all.sh.npm run checkpasses locally (format, lint, types).npm run build:llmsif I toucheddocs/utilities.md— not applicable,docs/untouched.🤖 Generated with Claude Code
https://claude.ai/code/session_01UX1gTGeMTyoXQyr1qUoQKd
Generated by Claude Code